<%@ page import="cn.bai.mvc.Customer" %><%--
  Created by IntelliJ IDEA.
  User: Admin
  Date: 12/24 0024
  Time: 14:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>

<%
    Object obj=request.getAttribute("message");
    if(obj !=null){
%>
<br>
<font color="red"><%= obj%></font>
<br>
<br>
<br>
<%
    }
    String id=null;
    String name=null;
    String address=null;
    String phone=null;
    String oldName=null;
    Customer customer= (Customer) request.getAttribute("customer");
    if(customer!=null){
        id=customer.getId()+"";
        name=customer.getName();
        address=customer.getAddress();
        phone=customer.getPhone();
        oldName=customer.getName();
    }else{
        id=request.getParameter("id");
        name=request.getParameter("oldName");
        address=request.getParameter("address");
        phone=request.getParameter("phone");
        oldName=request.getParameter("oldName");
    }

%>

    <form action="update.do" method="post">
        <input type="hidden" name="id" value="<%= id%>">
        <input type="hidden" name="oldName" value="<%= oldName%>">
        <table>
            <tr>
                <td>Name:</td>
                <td><input type="text" name="name" value="<%= name%>"></td>
            </tr>
            <tr>
                <td>Address:</td>
                <td><input type="text" name="address" value="<%= address%>"></td>
            </tr>
            <tr>
                <td>Phone:</td>
                <td><input type="text" name="phone" value="<%= phone%>"></td>
            </tr>
            <tr>
                <td colspan="2"><input type="submit" value="Submit"/></td>
            </tr>
        </table>
    </form>
</body>
</html>
